package com.controller;

import com.pojo.Cgsupplyrelation;
import com.service.CgsupplyrelationService;
import com.util.Pager;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/base/cgsupplyrelation")
public class CgsupplyrelationHandler {
    @Resource
    private CgsupplyrelationService cgsupplyrelationService;
    @RequestMapping("/searchByCgsupplyrelationPager")
    public Pager<Cgsupplyrelation> searchByCgsupplyrelationPager(Cgsupplyrelation cgsupplyrelation,Integer limit,Integer offset){
        Pager<Cgsupplyrelation> pager = new Pager<>();
        pager.setCondition(cgsupplyrelation);
        pager.setLimit(limit);
        pager.setOffSet(offset);
        return cgsupplyrelationService.searchByCgsupplyrelation(pager);
    }

    @RequestMapping("updateCgsupplyrelation")
    public String Cgsupplyrelation(Cgsupplyrelation cgsupplyrelation){
        String msg="修改失败！";
        int i = cgsupplyrelationService.update(cgsupplyrelation);
        if(i>0){
            msg="修改成功！";
        }
        return msg;
    }
}
